package com.wql.controller;

import com.aaa.entity.BBusinessInfo;
import com.aaa.entity.GGoods;
import com.aaa.util.JwtUtil;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wql.service.GGoodsService;
import com.wql.utils.WebUtils;
import com.wql.vo.SearchFormData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author wql
 * @version 1.0
 * @date 2023/3/4 15:43
 */

@RestController
@RequestMapping("/business/goods")
public class GoodsController {
    @Autowired
    private GGoodsService gGoodsService;

    @PostMapping("/selectAllGoodsInfoByBusinessId/{currentPage}/{pageSize}")
    public Result selectAllGoodsInfoByBusinessId(@PathVariable Integer currentPage , @PathVariable Integer pageSize,@RequestBody SearchFormData searchFormData){
        return gGoodsService.selectAllGoodsInfoByBusinessId(currentPage,pageSize,searchFormData);
    }
    @PostMapping("/updateGoods")
    public Result update(@RequestBody GGoods gGoods){
        return gGoodsService.changeGoods(gGoods);
    }

    @PostMapping("/addGoods")
    public Result addGoods(@RequestBody GGoods gGoods){
        return gGoodsService.addGoods(gGoods);
    }
    @PostMapping("/deleteGoodsById")
    public Result deleteGoodsById(Integer id){
        return  gGoodsService.delete(id);
    }
    @PostMapping("/updateStatus")
    public Result updateStatus(@RequestBody GGoods gGoods){
        return gGoodsService.updateStatus(gGoods);
    }
}
